<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="baseUri" value="${pageContext.request.contextPath }" scope="request"></c:set>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"+"post/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>问答系统首页</title>
   <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="fly,layui,前端社区">
  <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
  <link rel="stylesheet" href="../res/layui/css/layui.css">
  <link rel="stylesheet" href="../res/css/global.css">
<script src="../res/layui/layui.js"></script>

</head>
<body>

<!-- <div class="header">
  <div class="main">
    <a class="logo" href="index.jsp" title="网博" target="iframe">网博社区</a>
    <div class="nav">
      <a class="nav-this" href="index.jsp" target="iframe">
        <i class="iconfont icon-wenda"></i>问答
      </a>
    </div>
    
    <div class="nav-user">      
      登入后的状态
      
      <a class="avatar" href="../user/index.jsp" target="iframe">
        <img src="../res/images/avatar/11.jpg">
        <cite>贤心</cite>
        <i>VIP</i>
      </a>
      <div class="nav">
        <a href="../user/set.jsp" target="iframe"><i class="iconfont icon-shezhi"></i>设置</a>
        <a href="../user/login.jsp" target="iframe"><i class="iconfont icon-tuichu" style="top: 0; font-size: 22px;"></i>退了</a>
      </div>
    </div>
  </div>
</div> -->
<div class="main layui-clear">
  <div class="wrap">
    <div class="content" style="margin-right:0">
      <div class="fly-tab">
        <span>
          <a href="" class="tab-this" target="iframe">全部</a>
          <a href="" target="iframe">未结帖</a>
          <a href="" target="iframe">已采纳</a>
          <a href="" target="iframe">置顶帖</a>
          <a href="../user/index.jsp" target="iframe">我的帖</a>
        </span>
        <form action="" class="fly-search">
          <i class="iconfont icon-sousuo"></i>
          <input class="layui-input" autocomplete="off" placeholder="搜索内容，回车跳转" type="text" name="q">
        </form>
        <c:if test="${User.userName != null }">	<!-- 用户登录后显示 -->
        	<a href="showAddUI" class="layui-btn jie-add"  target="myIframe">发布问题</a>
        </c:if>
      </div>
      
      <ul class="fly-list">
      <!-- 循环打印 -->
      <c:forEach items="${requestScope.pageMsg.lists }" var="post" varStatus="loop">
       	<c:if test="${post.postStick == '已置顶' }">
      	
        <li class="fly-list-li">
          <a href="../user/home.jsp" class="fly-list-avatar" target="myIframe">
            <img src="../res/images/avatar/0.jpg" alt="">
          </a>
          <h2 class="fly-tip">
            <a href="showPostDetail?postId=${post.postId }" target="myIframe">${post.postTitle }</a>
            	<span class="fly-tip-stick">置顶</span>
          </h2>
          <p>
            <span><a href="../user/home.jsp" target="myIframe">${userMsg[loop.count-1].userName }</a></span>
            <span><fmt:formatDate value="${post.postUpdateTime }" pattern="yyyy-MM-dd HH:mm"/></span> 
            <span>${tabMsg[loop.count-1].tabName }</span>
            <span class="fly-list-hint"> 
              <i class="iconfont" title="回答">&#xe60c;</i> ${post.postReply }
              <i class="iconfont" title="人气">&#xe60b;</i> ${post.postBrowse }
            </span>
          </p>
        </li>
       </c:if>
       </c:forEach>
       
       <c:forEach items="${requestScope.pageMsg.lists }" var="post" varStatus="loop">
       	<c:if test="${post.postStick == '未置顶' }">
        <li class="fly-list-li">
          <a href="../user/home.html" class="fly-list-avatar"  target="myIframe">
            <img src="../res/images/avatar/00.jpg" alt="">
          </a>
          <h2 class="fly-tip">
            <a href="showPostDetail?title=${post.postTitle }&content=${post.postContent }
            &userName=${userMsg[loop.count-1].userName }
            &postCreateTime=<fmt:formatDate value="${post.postCreateTime }" pattern="yyyy-MM-dd HH:mm"/>
            &postReward=${post.postReward }
            &postReply=${post.postReply }
            &postBrowse=${post.postBrowse }
            &postStick=${post.postStick }
            &postStatus=${post.postStatus }
            &postId=${post.postId }&postUserId=${post.postUserId }" target="myIframe">${post.postTitle }</a>
            <!-- <span class="fly-tip-stick">置顶</span> -->
          </h2>
          <p>
            <span><a href="user/home.html">${userMsg[loop.count-1].userName }</a></span>
            <span><fmt:formatDate value="${post.postUpdateTime }" pattern="yyyy-MM-dd HH:mm"/></span>
            <span>${tabMsg[loop.count-1].tabName }</span>
            <span class="fly-list-hint"> 
              <i class="iconfont" title="回答">&#xe60c;</i> ${post.postReply }
              <i class="iconfont" title="人气">&#xe60b;</i> ${post.postBrowse }
            </span>
          </p>
        </li>
       </c:if>
       </c:forEach>
       
      </ul>
      
      <!-- <div class="fly-none">并无相关数据</div> -->
    
      <div style="text-align: center">
        <div class="laypage-main"><span class="laypage-curr">1</span><a href="">2</a>
        <a href="">3</a><a href="">4</a><a href="">5</a><span>…</span>
        <a href="" class="laypage-last" title="尾页">尾页</a><a href="" class="laypage-next">下一页</a></div>
        <br>
        <span> 第${requestScope.pageMsg.currPage }/${requestScope.pageMsg.totalPage}页</span>
			&nbsp;&nbsp; <span>总记录数：${requestScope.pageMsg.totalCount }&nbsp;&nbsp;每页显示:${requestScope.pageMsg.pageSize}</span>
			&nbsp;&nbsp;
      </div>
    
	    <!-- 页码显示 -->
		<div class="pageshow">
			<span>  <c:if
					test="${requestScope.pageMsg.currPage != 1}">
					<a href="${baseUri}/indexPost?currentPage=1">[首页]</a>&nbsp;&nbsp;
	         				<a
						href="${baseUri}/indexPost?currentPage=${requestScope.pageMsg.currPage-1}">[上一页]</a>
	         				&nbsp;&nbsp;
	     				</c:if> <c:if
					test="${requestScope.pageMsg.currPage != requestScope.pageMsg.totalPage}">
					<a
						href="${baseUri}/indexPost?currentPage=${requestScope.pageMsg.currPage+1}">[下一页]</a>&nbsp;&nbsp;
	         				<a
						href="${baseUri}/indexPost?currentPage=${requestScope.pageMsg.totalPage}">[尾页]</a>&nbsp;&nbsp;
	     				</c:if>
			</span>
		</div>
      
    </div>
  </div>
</div>
<!-- <div class="footer">
  <p><a href="#">网博社区</a> 2017 &copy; <a href="#/">njwangbo.com</a></p>
  <p>
    <a href="#" target="_blank">产品授权</a>
    <a href="#" target="_blank">网博社区</a>
    <a href="#" target="_blank">微信公众号</a>
  </p>
</div> -->

<script>
	/* window.onload=function(){
		layer.open({
			title:'二哥二哥'
			,content:'撒大的'
		});
	} */
layui.cache.page = '';
layui.cache.user = {
  username: '游客'
  ,uid: -1
  ,avatar: '../res/images/avatar/00.jpg'
  ,experience: 83
  ,sex: '男'
};
layui.config({
  version: "2.0.0"
  ,base: '../res/mods/'
}).extend({
  fly: 'index'
}).use('fly');
</script>
</body>
</html>
